<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <script type="text/javascript" src="jsunit/app/jsUnitCore.js"></script>
    <script type="text/javascript" src="../src/trial.js"></script>
    <script type="text/javascript">
    
		function setUp(){
			
		}
		
		function tearDown(){
			
		}
		
		function test_namespace(){
		
			assertTrue(trial.exists("trial.exists"));
		
		}
		
		var ci3k = {
			controls: {
				toString: function(){ return "ci3k.controls"; },
				MyControl: {
					toString: function(){ return "ci3k.controls.MyControl"; }
				}
			},
			toString: function(){ return "ci3k"; }
		};
		
	    var namespace = {
	    	toString: function(){ return "{namespace}"; }
	    };
        namespace.one = {
        	toString: function(){ return "{namespace.one}" },
        	a: {
        		toString: function(){ return "{namespace.one.a}" },
        		b: {
        			toString: function(){ return "{namespace.one.a.b}" },
        			c: {
        				toString: function(){ return "{namespace.one.a.b.c}" },
        			}
        		}
        	}
        };
        namespace.two = null;

		function test_simple(){
		
			assertTrue(trial.exists(namespace, "one"));
			
			assertFalse(trial.exists(namespace, "two"));
			
			assertFalse(trial.exists(namespace, "three"));
			
		}
		
		function test_complex(){
		
			assertTrue(trial.exists(namespace, "one.a.b.c"));

		}
		
		function test_onlySmallPath(){
		
			assertTrue(trial.exists("namespace"));
			assertFalse(trial.exists("namespacegg"));
		
		}
		
		function test_onlyBigPath(){
		
			assertTrue(trial.exists("namespace.one"));
			assertFalse(trial.exists("namespace.one.monkey"));
		
		}

		function test_initialContextDoesntExist(){
		
			assertFalse(trial.exists("something.else"));
		
		}

		function test_initialContextDoesntExist_2(){
		
			assertTrue(trial.exists("ci3k.controls.MyControl"));
		
		}

    </script>
</head>
<body>
</body>
</html>